sap.ui.jsview("zmmbe.plantView", {

    /** Specifies the Controller belonging to this View. 
	* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
	* @memberOf zmmbe.plantView
	*/ 
	getControllerName : function() {
		return "zmmbe.plantView";
	},

	/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed. 
	* Since the Controller is given to this method, its event handlers can be attached right away. 
	* @memberOf zmmbe.plantView
	*/ 
	createContent : function(oController) {

		var flexboxMatnr = new sap.m.FlexBox();
		flexboxMatnr.addItem( new sap.m.Label({text: "品目コード:"}));
		flexboxMatnr.addItem( new sap.m.Label({text: "{/matnr}"}));
		
		
		var flexboxMaktx = new sap.m.FlexBox();
		flexboxMaktx.addItem( new sap.m.Label({text: "品目名称:"}));
		flexboxMaktx.addItem( new sap.m.Label({text: "{/matnr}"}));		
		
		var oTable = new sap.m.Table("idTable", {
            headerToolbar: new sap.m.Toolbar({
            	content: [ 
            	new sap.m.ToolbarSpacer({})
            	]
            }),
            columns: [
            new sap.m.Column({
                   width: "1em",
                   header: new sap.m.Label({
                   text: "プラント"
                   })
            }),
            new sap.m.Column({
                   width: "1em",
                   header: new sap.m.Label({
                   text: "プラント名称"
                   })
            }),
            new sap.m.Column({
                   width: "1em",
                   header: new sap.m.Label({
                   text: "利用可能"
                   })
            }),
            new sap.m.Column({
                   width: "1em",
                   header: new sap.m.Label({
                   text: "出庫予定"
                   })
            }),
            new sap.m.Column({
            	   width: "1em",
            	   header: new sap.m.Label({
            	   text: "入庫予定"
            	   })
            })
            ]
        });
		
		var template = new sap.m.ColumnListItem({
		             id: "plantTemplate",
		             type: "Navigation",
		             visible: true,
		             selected: true,
		             cells: [ 
		             new sap.m.Text({
		             text: "{WERKS}"
		             }),
		             new sap.m.Text({
		             text: "{WERKS_NAME}"
		             }),
		             new sap.m.Text({
		             text: "{UNRESTRICTED_STCK}"
		             }),
		             new sap.m.Text({
		             text: "{RESERVATIONS}"
		             }),
		             new sap.m.Text({
			             text: "{REC_RESER}"
			             })
		             ]
		       });

		
		var oModel = new sap.ui.model.odata.ODataModel(
				"proxy/sap/opu/odata/sap/ZMMBE_SRV/",
				false, "zhong", "xsw23edc");
		oTable.setModel(oModel);
		var path = "plant_viewSet?$filter=(IwMatieral eq 'M-08')";
		oTable.bindItems(path, template);
//		var oMatnr = oJSONModel.getProperty("/matnr"); 

			
				
				
				
				
		var plantPage =new sap.m.Page("plantPage",{
            title: "プラント単位",
            content: [ 
                       flexboxMatnr,
                       flexboxMaktx,
                       oTable
                     ],
            showNavButton: true,
            navButtonTap:function(){
                app = sap.ui.getCore().byId("myApp");
                app.to("idselectView");
             }
            });


		return plantPage;
	}

});